﻿using SHKF.B2C.Model.Dto.Center;
using SHKF.B2C.Model.Entity.Center;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WQDSkin.Forms.Component; 

namespace SHKF.B2C.Mannage.AdminUI.View.CenterInfo.Company
{
    /// <summary>
    /// frmCompanyEdit.xaml 的交互逻辑
    /// </summary>
    public partial class frmCompanyEdit : BasePage
    {
        public frmCompanyEdit()
        {
            InitializeComponent();
        }

        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            CompanyEntity company = (CompanyEntity)this.DataContext;
            if (company == null)
            {
                company = new CompanyEntity();
            }

            CompanyDto dto = await GL.HttpClientManage.CompanySave(company);
            if (dto.error == null)
            {
                MessageBox.Show("保存成功!");
                this.DataContext = dto.data; 
            }
            else
            {
                MessageBox.Show(dto.error.msg);
            }

        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        { 
            base.Contain.CallBack(this.DataContext);
        }
    }
}
